package com.tanfuqi.sicent.server.controller

import io.swagger.annotations.ApiOperation
import org.apache.mina.core.service.IoAcceptor
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RestController
import reactor.core.publisher.Flux
import reactor.core.publisher.Mono

@RestController
class ShopController : BaseController() {

    @ApiOperation(value = "店铺状态")
    @GetMapping(value = ["/shop/connected"])
    fun active() =
            Mono.justOrEmpty<IoAcceptor>(acceptor).flatMapIterable {
                it.managedSessions.values
            }.map {
                it.getAttribute("shopId") as? String
            }.collectList()

}